import { Command } from "commander";
import { ICommand } from "../interface";
import { GenaratePluginDoc } from "../plugin-doc";

export class GenPluginDocCommand implements ICommand {
  load(program: Command): void {
    program
      .command("plugindoc")
      .description("生成插件文档")
      .option(
        '-c, --config <path>", "配置文件路径, 默认输出: ./plugin-doc-config.ts'
      )
      .action(this.action.bind(this));
  }

  async action(options: { config: string }): Promise<void> {
    GenaratePluginDoc(options.config);
  }
}
